#ifndef CSVEXPORTER_H
#define CSVEXPORTER_H

#include <QObject>
#include <QStringList>
#include <QFile>
#include <QTextStream>
#include <QMessageBox>

class CsvExporter : public QObject
{
    Q_OBJECT
public:
    explicit CsvExporter(QObject *parent = nullptr);

    // 设置CSV数据
    void setHeader(const QStringList &header);
    void addRow(const QStringList &row);
    void clearData();

    // 导出CSV文件
    bool exportToFile(const QString &filePath, const QString &separator = ",");

private:
    QStringList m_header;
    QList<QStringList> m_data;
};

#endif // CSVEXPORTER_H
